#pragma once

#include "../layout/renders/meshs.hpp"
#include "../layout/renders/nodes.hpp"
#include "../render/render.hpp"
namespace qbe::adsorb {

struct AdsorbModel {
  bool exist;         // 存在吸附点
  qlib::Vec2d point;  // 吸附的点
  // qlib::Vec2dArray edge;
  // uint8_t type;
  qlib::GeoPartType type;

  // 渲染
  // vsg::ref_ptr<render::MeshNode> render_node;
  // vsg::ref_ptr<layout::renders::GeoMeshNode> render_node;
  vsg::ref_ptr<layout::renders::PointMeshNode> render_node;
  bool render_update;
  bool render_clear;
  // std::vector<Data> items;

  // layout::SelectQuad::Node node;

  bool diagonal_enable;              // 斜角吸附起点位置
  qlib::Vec2d diagonal_start_point;  // 斜角吸附起点位置
  qlib::Vec2d diagonal_end_point;    // 斜角吸附起点位置

  bool mouse_move{false};
  bool mouse_press{false};
  double mouse_press_x, mouse_press_y;
  bool mouse_release{false};

  bool filter_select = false;  // 过滤选择对象

  // 设置过滤选择
  void set_filter_select() { filter_select = false; }

  void set_diagonal_start(const qlib::Vec2d& p) {
    diagonal_enable = true;
    diagonal_start_point = p;
  }
  void close_diagonal_start() {
    diagonal_enable = false;
    diagonal_start_point = {};
  }
};

}  // namespace qbe::adsorb